unit uEmpire;

interface

uses SysUtils,
     cuSimpleArrays, cuDebug;

type
  TEmpire = class( TObject )
  public
    empireName   : string;

    empirePopulation     : integer;
    empireMaxPopulation  : integer;
    empireGrowth         : integer;

    empirePlanets : TIntegerArray;
    empireFleets  : TIntegerArray;

    constructor Create();
    destructor Destroy();

    procedure Reset();

    procedure linkAstro(newPlanetID:integer);
    procedure unlinkAstro(thePlanetID:integer);
    procedure linkFleet(newFleetID:integer);
    procedure unlinkFleet(theFleetID:integer);
  end;

  TEmpireList = class( TObject )
  private
    m_Count : integer;
  public
    Items : array of TEmpire;
  end;

implementation

constructor TEmpire.Create();
begin
  inherited;

  empirePlanets := TIntegerArray.Create('TEmpire.empirePlanets');
  empireFleets  := TIntegerArray.Create('TEmpire.empireFleets');
end;

destructor TEmpire.Destroy();
begin

  FreeAndNil(empirePlanets);
  FreeAndNil(empireFleets);

  inherited;
end;

procedure TEmpire.Reset();
begin
  empireName := 'Empire';

  empirePopulation     := 0;
  empireMaxPopulation  := 0;
  empireGrowth         := 0;

  empirePlanets.clearArray('TEmpire.Reset');
  empireFleets.clearArray('TEmpire.Reset');
end;

procedure TEmpire.linkAstro(newPlanetID:integer);
begin
  DevConsole.Print(LOG_DEBUG2, 'TEmpire.linkAstro: Linking astro '+IntToStr(newPlanetID)+' to '+empireName);

  empirePlanets.addItem( newPlanetID ) // List of Colonies the empire controls
end;
procedure TEmpire.unlinkAstro(thePlanetID:integer);
begin
  //Remove the link from empire to colony.
  DevConsole.Print(LOG_DEBUG2, 'TEmpire.unlinkAstro: Unlinking Astro '+IntToStr(thePlanetID)+' from '+empireName);

  empirePlanets.DeleteByValue( thePlanetID );
end;

procedure TEmpire.linkFleet(newFleetID:integer);
begin
  DevConsole.Print(LOG_DEBUG2, 'TEmpire.linkFleet: Linking fleet '+IntToStr(newFleetID)+' to '+empireName);

  empireFleets.addItem( newFleetID ) // List of Colonies the empire controls
end;
procedure TEmpire.unlinkFleet(theFleetID:integer);
begin
  DevConsole.Print(LOG_DEBUG2, 'TEmpire.unlinkFleet: Unlinking fleet '+IntToStr(theFleetID)+' from '+empireName);

  empireFleets.DeleteByValue( theFleetID );
end;

end.
